home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Original Code / Text and Fonts / HuckleberryFinnHalfHeight / HuckleberryFinnHalfHeight.cs next >
Encoding:
Text File  |  2001-01-15  |  2.0 KB  |  51 lines

  1. //--------------------------------------------------------
  2. // HuckleberryFinnHalfHeight.cs ⌐ 2001 by Charles Petzold
  3. //--------------------------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Windows.Forms;
  7.  
  8. class HuckleberryFinnHalfHeight: Form
  9. {
  10.      public static void Main()
  11.      {
  12.           Application.Run(new HuckleberryFinnHalfHeight());
  13.      }
  14.      public HuckleberryFinnHalfHeight()
  15.      {
  16.           Text = "\"The Adventures of Huckleberry Finn\"";
  17.           BackColor = SystemColors.Window;
  18.           ForeColor = SystemColors.WindowText;
  19.           ResizeRedraw = true;
  20.      }
  21.      protected override void OnPaint(PaintEventArgs pea)
  22.      {
  23.           Graphics  grfx = pea.Graphics;
  24.           int       cx   = ClientSize.Width;
  25.           int       cy   = ClientSize.Height;
  26.           Pen       pen  = new Pen(ForeColor);
  27.           Rectangle rect = new Rectangle(0, 0, cx / 2, cy / 2);
  28.  
  29.           grfx.DrawString(     
  30.                "You don't know about me, without you " +
  31.                "have read a book by the name of \"The " +
  32.                "Adventures of Tom Sawyer,\" but that " +
  33.                "ain't no matter. That book was made by " +
  34.                "Mr. Mark Twain, and he told the truth, " +
  35.                "mainly. There was things which he " +
  36.                "stretched, but mainly he told the truth. " +
  37.                "That is nothing. I never seen anybody " +
  38.                "but lied, one time or another, without " +
  39.                "it was Aunt Polly, or the widow, or " +
  40.                "maybe Mary. Aunt Polly\x2014Tom's Aunt " +
  41.                "Polly, she is\x2014and Mary, and the Widow " +
  42.                "Douglas, is all told about in that book" +
  43.                "\x2014which is mostly a true book; with " +
  44.                "some stretchers, as I said before.", 
  45.                Font, new SolidBrush(ForeColor), rect);
  46.  
  47.           grfx.DrawLine(pen, 0,      cy / 2, cx / 2, cy / 2);
  48.           grfx.DrawLine(pen, cx / 2, 0,      cx / 2, cy / 2);
  49.      }
  50. }
  51.